using System;
using System.Collections.Generic;
using System.Text;
using Crm.Domain.TestUtil.ObjectMothers;
using NUnit.Framework;
using Crm.Domain;

namespace Ordering.Domain.Tests
{
    /// <summary>
    /// Tests for the stage based logic of an Order.
    /// </summary>
    [TestFixture]
    public class OrderTests
    {
        #region Tests

        [Test]
        public void CanCreateOrder()
        {
            Customer customer = CustomerObjectMother.Create();

            Order order = new Order(customer);

            Assert.AreEqual(customer, order.Customer, "Customer was not correctly associated with Order.");
        }

        [Test]
        public void StartsInNewState()
        {
            Order order = new Order(CustomerObjectMother.Create());

            Assert.AreEqual(OrderStateKind.New, order.State, "Orders should start out in the New state.");
        }

        [Test]
        public void CanProgressToProcessing()
        {
            Order order = new Order(CustomerObjectMother.Create());
            
            order.Processing();

            Assert.AreEqual(OrderStateKind.Processing, order.State, "Orders can move to the Processing state.");
        } 

        #endregion

        # region Tests - Expected Exceptions

        [Test]
        [ExpectedException(typeof(ArgumentNullException))]
        public void MustProvideCustomer()
        {
            new Order(null);
        }

        # endregion
    }
}
